package com.xc.controller;

import com.xc.model.dto.ResultDTO;
import com.xc.model.entity.FenleiSortEntity;
import com.xc.model.query.FenleiQuery;
import com.xc.model.query.FenleiSortQuery;
import com.xc.model.query.ProductQuery;
import com.xc.service.ProductService;
import com.xc.util.JSONCopy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;

    @GetMapping
    public ResultDTO getByFenleiId(FenleiSortQuery query) {
        return productService.getByFenleiId(JSONCopy.copy(query, FenleiSortEntity.class));
    }
}
